// 定义请求后端接口的方法
// 利用模块化操作

import request from '@/utils/request.js'

const api_name = '/copyrightin/bookList'

export default {
  // 带分页的条件查询
  query(pageNo, pageSize, bookListQuery) {
    // 调用后端接口 axios发出异步请求
    return request({
      url: `${api_name}/${pageNo}/${pageSize}`,
      method: 'post',
      data: bookListQuery
    })
  },
  // ## 添加书单
  saveBookList(bookList) {
    return request({
      url: `${api_name}/saveBookList`,
      method: 'post',
      data: bookList
    })
  },
  // ## 回显
  view(id) {
    return request({
      url: `${api_name}/${id}`,
      method: 'get'
    })
  },
  // ## 修改书籍
  updateBookList(bookList) {
    return request({
      url: `${api_name}/updateBookList`,
      method: 'put',
      data: bookList
    })
  },
  // ## 删除书籍
  deleteBookList(id) {
    return request({
      url: `${api_name}/${id}`,
      method: 'delete'
    })
  }
}
